import ajax from './index'
import { append } from './index'


//选品库-同步
export function supplyProductSync(){
  return ajax.post('/admin/product/supply_product/sync')
}

//选品库-推荐
export function supplyRecommendProduct(id){
   return ajax.post('/admin/product/supply_product/' + id + '/set_recommend')
}
//选品库-同步数量
export function supplyproductSyncCount(){
  return ajax.get('/admin/product/supply_product/sync_count')
}
//选品库-商品列表
export function  supplyProductSearchList(url){
  return ajax.get('/admin/product/supply_product/search?'+url)
}
//选品库-商品图片
export function  supplyProductImgList(product_no){
  return ajax.get('/admin/product/supply_product/' + product_no + '/img/list')
}

//选品库-sku信息 
export function  supplyProductSkuList(product_no){
  return ajax.get('/admin/product/supply_product/' + product_no + '/sku/list')
}



//选品库/自营---商品库详情
export function  selfproductDetail(product_no){
    return ajax.get('/admin/product/self_product/' + product_no + '/detail')
}

//自营-更新商品详情设置
export function  selfproductUpdate(product_no,data){
    return ajax.post('/admin/product/self_product/' + product_no + '/update',data)
}

//自营商品列表
export function selfProductSearchList(url){
  return ajax.get('/admin/product/self_product/search?'+url)
}

//自营商品列表更新上下架状态
export function  selfProductOnsaleUpdate(product_no,data){
  return ajax.post('/admin/product/self_product/'+product_no+'/on_sale/update',data)
}

//自营商品-移出
export function  selfProductRemove(product_no){
  return ajax.post('/admin/product/self_product/' + product_no + '/remove')
}

//选品库-商品分类-列表
export function  supplyproductCateList(url){
  return ajax.get('/admin/product/cate/list?' + url)
}

//商品分类-新增
export function productCateCreate(data){
  return ajax.post('/admin/product/cate/create',data)
}

//商品分类-更新
export function productCateIDUpdate(product_id,data){
  return ajax.post('/admin/product/cate/' + product_id + '/update',data)
}

//商品分类-更新排序
export  function  productCateOrderUpdate(product_id,data){
   return ajax.post('/admin/product/cate/' + product_id + '/order_order/update',data)
}

//商品分类-更新是否启用
export function  productCateIsEnableUpdate(product_id,data){
  return ajax.post('/admin/product/cate/' + product_id + '/is_enable/update',data
  )
}

//商品分类-删除
export function  productCateIdDelete(product_id){
  return ajax.post('/admin/product/cate/' + product_id + '/delete')
}


//自营订单列表
export function orderSupplySearch(url){
  return ajax.get('/admin/order/supply/search?'+url)
}

//自营订单详情
export function orderDetailGet(orderNo){
  return ajax.get('/admin/order/supply/order_detail/' + orderNo + '/get')
}

//关闭订单
export function closeOrderUpdate(data){
  return ajax.post('/admin/order/supply/close_order/update', data)
}

//订单退款日志创建
export function orderrefundlogCreate(data){
  return ajax.post('/admin/order/order_refund_log/create', data)
}

//订单退款日志列表
export function orderrefundloglist(order_id){
  return ajax.get('/admin/order/' + order_id + '/order_refund_log/list')
}



//服务商专区套餐列表
export function  serviceProviderspackageList(url){
  return ajax.get('/admin/serviceProviders/package/list?'+url)
}

//新增套餐
export function addServiceProviders(data) {
  return ajax.post('/admin/serviceProviders/package/create', data)
}

//套餐启用与禁用
export function updateIsEnable(id,data){
  return ajax.post('/admin/serviceProviders/package/'+id+'/updateIsEnable',data)
}

//套餐删除
export function  deleteserviceProvidersPackage(id){
  return ajax.post('/admin/serviceProviders/package/' + id + '/delete')
}

//套餐选品列表
export function serviceProvidersProductList(id,url){
  return ajax.get('/admin/serviceProviders/package/' + id + '/productList?'+url)
}

//套餐商品入库
export function serviceProductCreate(data){
  return ajax.post('/admin/serviceProviders/package/productCreate',data)
}

//套餐商品移出
export function serviceProvidedeleteProduct(data){
  return ajax.post('/admin/serviceProviders/package/deleteProduct',data)
}

//套餐sku列表
export function serviceProductSkuList(product_id){
  return ajax.get('/admin/serviceProviders/package/productSkuList?product_id='+product_id)
}

//套餐已入库商品
export function servicePackageisChoiceList(packageId){
  return ajax.get('/admin/serviceProviders/package/'+packageId+'/isChoicedProductList')
}

//服务商订单列表
export function orderservicePackage(url){
  return ajax.get('/admin/order/service_package/search?' + url)
}

//服务商加入订单列表
export const serviceJoinOrder = data => {
  return ajax.get(`partner_admin/service_provider/orders/search${append(data)}`)
}


//模版列表
export function freightTemplateList(url){
  return ajax.get('/admin/freight/freight_templates/list?'+url)
}

//运费模版创建
export function freightTemplateAdd(data){
  return ajax.post('/admin/freight/template/add',data)
}

//行政区域分组列表
export function freightRegionGroups(){
  return ajax.post('/admin/region/groups')
}

//删除模版
export function delFreighttemplate(id){
  return ajax.post('/admin/freight/freight_template/'+id+'/delete')
}

//模版详情
export function freightTemplateDetailData(id){
  return ajax.post('/admin/freight/template/detail',id)
}

//一级目录
export function freightProductSupplyProductCate(url){
  return ajax.get('/admin/product/supply_product/cate?'+url)
}

//模版编辑
export function freightTemplateEdit(data){
  return ajax.post('/admin/freight/template/edit',data)
}

//物流信息
export function  orderLogistics(id){
  return ajax.get('/admin/order/'+id+'/order_logistics/get')
}

